Skip to content

feat: separate GraphQL types into @launchql/types package#399

Closed
pyramation wants to merge 3 commits into
mainfrom
devin/1765678646-separate-types-packages
Closed

feat: separate GraphQL types into @launchql/types package#399
pyramation wants to merge 3 commits into
mainfrom
devin/1765678646-separate-types-packages

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented Dec 14, 2025

feat: separate GraphQL types into @launchql/types package

Summary

This PR achieves complete architectural separation of GraphQL/Graphile-specific code from the core PGPM packages. The goal is to ensure pgpm (PostgreSQL Package Manager) has zero GraphQL dependencies in its dependency chain.

Changes:

  • Created new @launchql/types package (v2.11.0) with GraphileOptions, ApiOptions, GraphileFeatureOptions, and LaunchQLOptions
  • Created new @launchql/env package (v2.7.0) that handles GraphQL env parsing and defaults
  • Removed postgraphile and graphile-build dependencies from @pgpmjs/types
  • Stripped GraphQL env vars (GRAPHILE_*, FEATURES_*, API_*) from @pgpmjs/env
  • Updated @pgpmjs/env to return only core PgpmOptions (no GraphQL fields)
  • Updated all LaunchQL consumer packages to import from @launchql/env:
    • packages/server, packages/explorer, packages/cli
    • graphile/graphile-settings, graphile/graphile-test, graphile/graphile-upload-plugin
    • packages/launchql-test

Architecture after this PR:

  • @pgpmjs/types + @pgpmjs/env = core PGPM (zero GraphQL deps)
  • @launchql/types + @launchql/env = LaunchQL (GraphQL features)

Updates since last revision

Completed the full architectural separation by creating @launchql/env package. Previously, GraphQL defaults were added to @pgpmjs/env as a workaround, but this violated the separation goal. Now:

  1. @launchql/env wraps @pgpmjs/env and adds GraphQL-specific functionality
  2. @pgpmjs/env is now purely core PGPM with no GraphQL concepts
  3. All LaunchQL packages import getEnvOptions from @launchql/env instead of @pgpmjs/env
  4. @launchql/env re-exports utilities like getNodeEnv for convenience

Review & Testing Checklist for Human

  • Verify GraphQL defaults: Check that launchqlGraphqlDefaults in @launchql/types has correct values (simpleInflection: true, oppositeBaseNames: true, postgis: true, etc.)
  • Test mutation names: Run launchql-gen tests or start server locally to verify PostGraphile generates correct mutation names (e.g., deletePost not deletePostById)
  • Verify pgpm isolation: Run pgpm deploy or other pgpm commands and confirm no GraphQL packages are loaded
  • Check consumer updates: Search for any remaining imports of getEnvOptions from @pgpmjs/env in LaunchQL packages that may have been missed
  • Test config file loading: The loadConfigSync result is cast to Partial<LaunchQLOptions> in @launchql/env/src/merge.ts - verify config files with GraphQL options are handled correctly

Recommended test plan:

  1. Run pnpm build to verify TypeScript compilation
  2. Run pnpm test across the monorepo (especially launchql-gen, graphile-settings, server)
  3. Start the LaunchQL server locally and verify GraphQL endpoint works
  4. Verify pgpm commands work without pulling in GraphQL dependencies

Notes

  • This is a breaking change for any external consumers importing GraphQL types from @pgpmjs/types or using @pgpmjs/env for GraphQL options
  • The @launchql/types package re-exports all types from @pgpmjs/types for convenience
  • The @launchql/env package re-exports core utilities from @pgpmjs/env for convenience
  • Some package.json files have minor indentation changes from editing
  • Session: https://app.devin.ai/sessions/7932131027f143eb8905938bd0c56a1a
  • Requested by: Dan Lynch (@pyramation)

- Create new @launchql/types package (v2.11.0) with GraphQL/Graphile types
- Remove postgraphile and graphile-build dependencies from @pgpmjs/types
- Move GraphileOptions, ApiOptions, FeatureOptions to @launchql/types
- Add EnvOptions and EnvGraphQLOptions types to @pgpmjs/env
- Update consumer packages to use @launchql/types for GraphQL types
- Ensures pgpm has zero GraphQL dependencies in its dependency chain

Packages updated:
- @pgpmjs/types: removed graphile deps, kept core PGPM types
- @pgpmjs/env: added EnvOptions type for full env var parsing
- @launchql/types: new package with LaunchQLOptions, GraphileOptions, etc.
- @launchql/server, @launchql/explorer: use LaunchQLOptions
- graphile-settings, graphile-test, launchql-test: use @launchql/types

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration Bot and others added 2 commits December 14, 2025 02:36
Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Create new @launchql/env package that handles GraphQL env parsing and defaults
- Strip GraphQL env vars from @pgpmjs/env (GRAPHILE_*, FEATURES_*, API_*)
- Update @pgpmjs/env to return only core PgpmOptions (no GraphQL fields)
- Update all LaunchQL consumers to use @launchql/env:
  - packages/server, explorer, cli
  - graphile/graphile-settings, graphile-test, graphile-upload-plugin
  - packages/launchql-test
- @launchql/env exports getEnvOptions() that merges core + GraphQL options
- Re-exports getNodeEnv and other utilities from @pgpmjs/env for convenience

This completes the architectural separation where:
- @pgpmjs/types + @pgpmjs/env = core PGPM (zero GraphQL deps)
- @launchql/types + @launchql/env = LaunchQL (GraphQL features)

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
@pyramation pyramation closed this Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant